package com.remon.quartz.controller;

import com.remon.quartz.entity.QuartzTriggers;
import com.remon.quartz.service.QuartzTriggersService;
import com.remon.quartz.vo.PageRes;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * 触发器控制器
 *
 * @author remon
 * @create 2018-09-08 22:28
 **/
@RestController
@RequestMapping("triggers")
public class QuartzTriggersController {

    /**
     * 触发器逻辑处理对象
     */
    private final QuartzTriggersService quartzTriggersService;

    public QuartzTriggersController(QuartzTriggersService quartzTriggersService) {
        this.quartzTriggersService = quartzTriggersService;
    }

    /**
     * 分页获取触发器
     * @param pageNo 跳转页
     * @param pageSize 每页数据条数
     * @return @link{ PageRes } @link{ QuartzTriggers }
     */
    @GetMapping("page/{pageNo}/{pageSize}")
    public PageRes<QuartzTriggers> pages(@PathVariable("pageNo") Integer pageNo, @PathVariable("pageSize") Integer pageSize) {
        return quartzTriggersService.pages(pageNo, pageSize, null);
    }
}
